#include "Thread01.h"
#include <QThread>
PlayPCMThread::PlayPCMThread(QObject *parent) : QThread(parent)
{
    this->init();
}

PlayPCMThread::PlayPCMThread(int count, QObject *parent):QThread(parent)
{
    this->count = count;
    this->init();
}

void PlayPCMThread::init()
{
    connect(this,&QThread::finished,this,&QThread::deleteLater);
}

PlayPCMThread::~PlayPCMThread()
{
    // 删除构造函数里面定义的信号槽
    disconnect();
    // 发送中断请求
    requestInterruption();
    quit();
    wait();
    qDebug() << "PlayPCMThread 析构";
}

void PlayPCMThread::run()
{

    while (!isInterruptionRequested() && this->count > 0) {

        QThread::sleep(1);
        qDebug() << "111";
        emit callBack(this->count);
        this->count--;
    }
}


